package com.qingcloud.adminbackend.entity.app;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 数据源
 * </p>
 *
 * @author wangjinnan
 * @since 2021-01-12
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("df_datasource")
public class AppDataSource implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键，公用开发作业主键
     */
    @TableId(type = IdType.INPUT)
    @ApiModelProperty(value = "主键ID", example = "1")
    private Integer id;

    @ApiModelProperty(value = "名称")
    private String name;

    @ApiModelProperty(value = "编码", example = "1", hidden = true)
    private String code;

    @ApiModelProperty(value = "应用Id", example = "1")
    private Integer appId;

    @ApiModelProperty(value = "适用范围 1-应用 2-系统", example = "1")
    private Integer origin;

    @ApiModelProperty(value = "所属项目ID", example = "1", hidden = true)
    private String projectId;

    @ApiModelProperty(value = "数据源类型", example = "1")
    private Integer type;

    @TableField(exist = false)
    @ApiModelProperty(value = "数据源类型", example = "1")
    private String typeName;

    @ApiModelProperty(value = "数据库名称, redis叫数据库索引", example = "1")
    private String catalog;

    @ApiModelProperty(value = "服务器IP地址", example = "1")
    private String ip;

    @ApiModelProperty(value = "端口", example = "1")
    private Integer port;

    @ApiModelProperty(value = "用户名", example = "1")
    private String username;

    @ApiModelProperty(value = "密码", example = "1")
    private String password;

    @TableField(exist = false)
    @ApiModelProperty(value = "JDBC链接", hidden = true)
    private String jdbcUrl;

    @ApiModelProperty(value = "创建时间", hidden = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "创建人", hidden = true)
    private String createUser;

}
